#是否闰年
def is_leap_year(y):
    return y%400==0 or (y%4==0 and y%100!=0)

#距离1年1月1日距离几天
def day_distance(y,m,d):
    sum=0
    for i in range(1850,y):
        sum+=365
        if is_leap_year(i):
            sum+=1
    month=[0,31,28,31,30,31,30,31,31,30,31,30,31]
    if is_leap_year(y):
        month[2]+=1
    for i in range(1,m):
        sum+=month[i]
    return sum+d-1

#指定日期是星期几
def xingqi(y,m,d):
    d1=day_distance(y,m,d)
    d1%=7
    d1+=2
    d1%=7
    if d1==0:
        d1=7
    return d1

a,b,c,y1,y2=map(int,input().split())

for i in range(y1,y2+1):
    xq=xingqi(i,a,1)
    first=1
    if xq<c:
        first+=(c-xq)
    elif xq>c:
        first=first+7-(xq-c)
    first+=(b-1)*7

    month=[0,31,28,31,30,31,30,31,31,30,31,30,31]
    if is_leap_year(i):
        month[2]+=1

    if first>month[a]:
        print("none")
    else:
        print(str(i)+"/%02d"%a+"/%02d"%first)

